#
# 6.863 -- Final Project
#
# Author: Capen Low
# Contact: capen@mit.edu
# 5/11/11
#

from src.train.ngramTrain import *
from src.populate.Populate import *
from src.evaluate.evaluateGrid import *
from src.evaluate.taggerEvaluation import *

if __name__ == '__main__':
    '''
    Test cases for the grid functionality
    '''
    
    nrTrials = 30
    
    print "training..."
    trainModel = NgramTrain(3, None, "treebank")

    print "initializing..."
    GB = GridBuilder("likelier", trainModel, trainModel, 10, 10)
    evaluator = Evaluate(10, 10)

    print "building..."
    for trial in range( nrTrials):
        #construct the grid
        grid = GB.constructGrid()
        
        # find the best path in the grid starting at (0,0)
        (words, probabilities, positions)= evaluator.pathFinder(grid, (0,0))
        
        # write to file the grid with the best found path 
        # and the probability matrix
        GB.writeReadableGrid(grid, True, positions)
        GB.writeReadableGrid(grid, False)
    
    print "generating comparable sentences .... "
    trainModel.generateComparableSentences()
    
    print "evaluating..."
    taggerEvaluate = TaggerEvaluation()
    taggerEvaluate.startEvaluation()
        
